#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>

int score[1005] = { 0 };
int main()
{
	int n;
	int ret = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &score[i]);
		ret += score[i];
	}
	for (int a = 0, b = 1; b < n; a++, b++) {
		if (score[a] > score[b]) {
			score[a] = score[a] + score[b];
			score[b] = score[a] - score[b];
			score[a] = score[a] - score[b];
		}
	}
	ret -= score[n - 1];
	for (int a = 0, b = 1; b < n; a++, b++) {
		if (score[a] < score[b]) {
			score[a] = score[a] + score[b];
			score[b] = score[a] - score[b];
			score[a] = score[a] - score[b];
		}
	}
	ret -= score[n - 1];
	printf("%.2f", 1.0*ret / (n-2));
	return 0;
}